<!doctype html>
<title>HTMLTrackElement.src</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
test(function(){
    var track = document.createElement('track');
    assert_equals(track.src, '');
    assert_equals(track.getAttribute('src'), null);
}, document.title + ' missing value');

test(function(){
    var track = document.createElement('track');
    track.setAttribute('src', '');
    assert_equals(track.src, '');
    assert_equals(track.getAttribute('src'), '');
}, document.title + ' empty string in content attribute');

test(function(){
    var track = document.createElement('track');
    track.src = '';
    assert_equals(track.src, '');
    assert_equals(track.getAttribute('src'), '');
}, document.title + ' empty string in IDL attribute');

test(function(){
    var track = document.createElement('track');
    track.setAttribute('src', 'http://foo bar');
    assert_equals(track.src, 'http://foo bar');
    assert_equals(track.getAttribute('src'), 'http://foo bar');
}, document.title + ' unresolvable value in content attribute');

test(function(){
    var track = document.createElement('track');
    track.setAttribute('src', 'test');
    var link = document.createElement('a');
    link.setAttribute('href', 'test');
    assert_equals(track.src, link.href);
    assert_equals(track.getAttribute('src'), 'test');
}, document.title + ' resolvable value in content attribute');

test(function(){
    var track = document.createElement('track');
    track.setAttribute('src', '\u0000');
    var link = document.createElement('a');
    link.setAttribute('href', '%00');
    assert_equals(track.src, link.href);
    assert_equals(track.getAttribute('src'), '\u0000');
}, document.title + ' \\u0000 in content attribute');

test(function(){
    var track = document.createElement('track');
    track.src = 'http://foo bar';
    assert_equals(track.src, 'http://foo bar');
    assert_equals(track.getAttribute('src'), 'http://foo bar');
}, document.title + ' assigning unresolvable value to IDL attribute');

test(function(){
    var track = document.createElement('track');
    track.src = 'test';
    var link = document.createElement('a');
    link.setAttribute('href', 'test');
    assert_equals(track.src, link.href);
    assert_equals(track.getAttribute('src'), 'test');
}, document.title + ' assigning resolvable value to IDL attribute');

test(function(){
    var track = document.createElement('track');
    track.src = '\u0000';
    var link = document.createElement('a');
    link.setAttribute('href', '%00');
    assert_equals(track.src, link.href);
    assert_equals(track.getAttribute('src'), '\u0000');
}, document.title + ' assigning \\u0000 to IDL attribute');

</script>
